﻿@model Planisoft.Entities.Dependiente

    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#idUbiDpto").change(function () {
                alert('cambiastes el departamento = ' + $("#idUbiDpto").val());
            })
        }
        );

    //        $("#MismaTitular").click(function () {

//            $('input:radio:nth(0)').attr('checked', true), alert('cambiaste a masculino');
//            //$('input:radio[name=sex]')[0].checked = true;            
//            $("#Diferente").attr('checked', false);
//        });

    //        $("#Diferente").click(function () {

//            $('input:radio[name=sex]:nth(1)').attr('checked', true), alert('cambiaste a Femenino');
//            $("#MismaTitular").attr('checked', false);
//        });
    </script>
    

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Dependiente</legend>
        <table>
            <tr>                
                <td>
                    @Html.Label("Tipo Documento")
                    @Html.DropDownList("IdTipoDocumento")                   
                    @*@Html.EditorFor(model => model.IdTipoDocumento)*@
                    @Html.ValidationMessageFor(model => model.IdTipoDocumento)                    
                </td>                                
                <td>                       
                    @Html.Label("Nº del Documento")
                    @Html.EditorFor(model => model.NroDocDep)
                    @Html.ValidationMessageFor(model => model.NroDocDep)                    
                </td>
            </tr>
            <tr>                
                <td>                    
                    @Html.Label("Apellido Paterno")
                    @Html.EditorFor(model => model.ApPatDep)
                    @Html.ValidationMessageFor(model => model.ApPatDep)                    
                </td>
                <td>                    
                    @Html.Label("Vinculo Familiar")
                    @*@Html.EditorFor(model => model.IdVinculoFam)*@
                    @Html.DropDownList("IdVinculoFam")
                    @Html.ValidationMessageFor(model => model.IdVinculoFam)                    
                </td>                
            </tr>
            <tr>
                <td>                 
                    @Html.Label("Apellido Materno")
                    @Html.EditorFor(model => model.ApMatDep)
                    @Html.ValidationMessageFor(model => model.ApMatDep)                    
                </td>                
                <td>
                    <fieldset>
                        <legend>Direccion:</legend>
                        <table>
                            <tr>
                                <td>                                   
                                    @Html.RadioButton("MismaTitular", new { @checked = false },true)
                                    @Html.Label("Misma del Titular")                                    
                                </td>
                                <td>
                                    @Html.RadioButton("Diferente", new { @checked = false },false)
                                    @Html.Label("Diferente")
                                </td>
                            </tr>
                        </table>                        
                    </fieldset>
                </td>                
            </tr>
            <tr>
                <td>                   
                    @Html.Label("Nombre")
                    @Html.EditorFor(model => model.NombDep)
                    @Html.ValidationMessageFor(model => model.NombDep)                    
                </td>                
            </tr>
        </table>
        <table>
            <tr>                
                <td>                    
                    @Html.Label("Fech. Nacimiento")
                    @Html.EditorFor(model => model.FechNacDep)
                    @Html.ValidationMessageFor(model => model.FechNacDep)                    
                    <fieldset>
                            <legend>Sexo</legend>
                            <table>
                                <tr>
                                    <td>
                                        @Html.RadioButtonFor(model => model.Sexo, "M", new { @checked = true })                                  
                                        @*@Html.RadioButton("Masculino", new { @checked = false },true)*@
                                        @Html.Label("Masculino")
                                    </td>
                                    <td>
                                        @Html.RadioButtonFor(model => model.Sexo, "F")
                                        @*@Html.RadioButton("Femenino",new { @checked = false },false)*@
                                        @Html.Label("Femenino")
                                    </td>
                                </tr>
                            </table>                            
                        </fieldset>                 
                </td>                
                <td>
                    <fieldset>
                        <legend>Ubugeo</legend>
                        <table>
                            <tr>
                                <td>
                                    <div class="editor-label">
                                        @Html.Label("Departamento")
                                    </div>
                                    <div class="editor-field">
                                        @*@Html.EditorFor(model => model.idUbiDpto)*@
                                        @Html.DropDownList("idUbiDpto")
                                        @Html.ValidationMessageFor(model => model.idUbiDpto)
                                    </div>
                                </td>
                                <td>
                                    <div class="editor-label">
                                        @Html.Label("Zona")
                                    </div>
                                    <div class="editor-field">
                                        @* @Html.EditorFor(model => model.IdZona)*@
                                        @Html.DropDownList("IdZona")
                                        @Html.ValidationMessageFor(model => model.IdZona)
                                    </div>
                                </td>                                
                            </tr>
                            <tr>
                                <td>
                                    <div class="editor-label">
                                        @Html.Label("Provincia")
                                    </div>
                                    <div class="editor-field">
                                        @*@Html.EditorFor(model => model.IdUbiProv)*@
                                        @Html.DropDownList("IdUbiProv")
                                        @Html.ValidationMessageFor(model => model.IdUbiProv)
                                    </div>
                                </td>
                                <td>
                                    <div class="editor-label">
                                        @Html.Label("Via")
                                    </div>
                                    <div class="editor-field">
                                        @*@Html.EditorFor(model => model.IdVia)*@
                                        @Html.DropDownList("IdVia")
                                        @Html.ValidationMessageFor(model => model.IdVia)
                                    </div>
                                </td>                                
                            </tr>
                            <tr>
                                <td>
                                    <div class="editor-label">
                                        @Html.Label("Distrito")
                                    </div>
                                    <div class="editor-field">
                                        @*@Html.EditorFor(model => model.IdUbiDtto)*@
                                        @Html.DropDownList("IdUbiDtto")
                                        @Html.ValidationMessageFor(model => model.IdUbiDtto)
                                    </div>
                                </td>                               
                            </tr>                            
                        </table>
                    </fieldset>
                </td>             
            </tr>            
            <tr>
                <td>
                    <input type="submit" value="AgregarDependiente" />                    
                </td>
                <td>
                    @Html.ActionLink("Cancelar", "IdexDependiente")
                </td>                             
            </tr>          
        </table>        
@*
        <div class="editor-label">
            @Html.LabelFor(model => model.IdDependiente)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdDependiente)
            @Html.ValidationMessageFor(model => model.IdDependiente)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdTrabajador)
        </div>
        <div class="editor-field">            
            @Html.EditorFor(model => model.IdTrabajador)
            @Html.ValidationMessageFor(model => model.IdTrabajador)
            
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdEps)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdEps)
            @Html.ValidationMessageFor(model => model.IdEps)
        </div>
*@
        <div class="editor-label">
            @Html.LabelFor(model => model.IndActivo)        
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IndActivo)
            @Html.ValidationMessageFor(model => model.IndActivo)
        </div>        
    </fieldset>
    @*<fieldset>
        <legend>Dependiente</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdDependiente)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdDependiente)
            @Html.ValidationMessageFor(model => model.IdDependiente)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdTrabajador)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdTrabajador)
            @Html.ValidationMessageFor(model => model.IdTrabajador)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdEps)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdEps)
            @Html.ValidationMessageFor(model => model.IdEps)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.idUbiDpto)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.idUbiDpto)
            @Html.ValidationMessageFor(model => model.idUbiDpto)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdUbiProv)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdUbiProv)
            @Html.ValidationMessageFor(model => model.IdUbiProv)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdUbiDtto)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdUbiDtto)
            @Html.ValidationMessageFor(model => model.IdUbiDtto)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdZona)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdZona)
            @Html.ValidationMessageFor(model => model.IdZona)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdVia)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdVia)
            @Html.ValidationMessageFor(model => model.IdVia)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.NroDocDep)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NroDocDep)
            @Html.ValidationMessageFor(model => model.NroDocDep)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ApPatDep)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ApPatDep)
            @Html.ValidationMessageFor(model => model.ApPatDep)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ApMatDep)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ApMatDep)
            @Html.ValidationMessageFor(model => model.ApMatDep)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.NombDep)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.NombDep)
            @Html.ValidationMessageFor(model => model.NombDep)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.FechNacDep)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FechNacDep)
            @Html.ValidationMessageFor(model => model.FechNacDep)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IndActivo)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IndActivo)
            @Html.ValidationMessageFor(model => model.IndActivo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdTipoDocumento)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdTipoDocumento)
            @Html.ValidationMessageFor(model => model.IdTipoDocumento)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.IdVinculoFam)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IdVinculoFam)
            @Html.ValidationMessageFor(model => model.IdVinculoFam)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>*@
}

<div>
    @Html.ActionLink("Back to List", "/IdexDependiente")
</div>
